<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单入库</title>
</head>
<body>
<script type="text/javascript">
$(function(){
	$("#eplanOrder_select_open").textbox({onClickButton: function(){
		$("#checkEplanOrder_select").window("open");
	}});
	
});
function SaveEquipOrder(){
	$("#from_order_saveStroage").form('submit',{	
		url:'save_equipOrderStroage',
		onSubmit: function(param){
			var rows=$("#save_equip_SOE").datagrid("getRows");		
			for(var i=0;i<rows.length;i++){
				param['storageDetails[' + i +'].sdetailName']=rows[i].sdetailName;
				param['storageDetails[' + i +'].sdetailNum']=rows[i].sdetailNum;
				param['storageDetails[' + i +'].sdetailMdate']=rows[i].sdetailMdate;
				param['storageDetails[' + i +'].sdetailEdate']=rows[i].sdetailEdate;
				param['storageDetails[' + i +'].sdetailRemarks']=rows[i].sdetailRemarks;
				param['storageDetails[' + i +'].sdetailComp']=rows[i].sdetailutil;
				param['storageDetails[' + i +'].sdetailType']=rows[i].sdetailtype;
			}
			 var isValid = $(this).form('validate');
			if (!isValid){
				$.messager.progress('close');	// 如果表单是无效的则隐藏进度条
			}
			return isValid;	// 返回false终止表单提交	 
		},
		success: function(v){
			var json = eval("(" + v + ")");
			$.messager.alert("操作提示", 
					json.success ? "操作成功" 
					: ("操作失败，原因为：" + json.reason));
			$("#from_order_saveStroage").form("reset");
			var rows = $("#save_equip_SOE").datagrid("getRows");
			for(var i=rows.length-1;i>=0;i--){
				$('#save_equip_SOE').datagrid('deleteRow', i);
			}
			var rows2 = $("#Equip_Order_Details_tabs").datagrid("getRows");
			for(var i=rows2.length-1;i>=0;i--){
				$('#Equip_Order_Details_tabs').datagrid('deleteRow', i);
			}
			createStorageId();
			$('#BuyEplanOrder_list_tabs').datagrid('load');
			
		}
	});
	
}
</script>
<div class="easyui-panel" data-options="border:false,fit:true,onOpen:createStorageId">
	<form id="from_order_saveStroage" action="save_equipOrderStroage" method="post"> 
		<table width="100%" border="0" style="padding:6px;">
		<tr>
			<td style="width: 30%;"><input name="equipStorage.estorageId" class="easyui-textbox" label="入库编号*" style="width:250px" id="EquipOrderSaveId" readonly="readonly"></td>
			<td style="width: 30%;"><select name="equipStorage.estorageState" class="easyui-combobox" label="状态"  
			data-options="required:true,validType:'isBlank',panelHeight: 'auto',width:200">				
				<option value=""></option>
				<option value="已入库">已入库</option>
			</select></td>
			<td style="width:30%;"><input style="width:60%;" name="equipStorage.estorageDate" class="easyui-datebox" label="入库日期" value="1" data-options="required:true,validType:'isBlank'"/></td>	
		</tr>
		<tr>	
			<td><input name="equipOrderId" id="eplanOrder_select_open" class="easyui-textbox" label="订单选择" data-options="buttonText:'选择',width:250,required:true,validType:'isBlank'"></td>
			<td><input  class="easyui-textbox" style="width:50%;" label="采购员" id="eplanOrder_cgName" readonly="readonly"></td>
			<td><input name="businessName" class="easyui-textbox" style="width:60%;" label="供应商" id="eplanOrder_gBusiness"></td>
		</tr>	
		<tr>
				
			<td style="width: 30%;"><select name="equipStorage.estorageKeeper" style="width:50%;" class="easyui-combobox" label="仓管员" data-options="panelHeight: 'auto',required:true,validType:'isBlank'">
								<option value="批次采购">张鑫</option>
								<option value="补货采购">李四</option>
				</select></td>	
			<td style="width: 30%;">
				<input name="equipStorage.estorageAgent" class="easyui-textbox" label="经办人" data-options="required:true,validType:'isBlank',width:200">
			</td>	
			<td style="width: 30%;"><select name="equipStorage.estorageType" style="width:50%;" class="easyui-combobox" label="入库类型" data-options="panelHeight: 'auto',required:true,validType:'isBlank'">
								<option value="批次入库">批次入库</option>
								<option value="补货入库">补货入库</option>
				</select></td>			
		</tr>
	
		</table>
	
	<div class="easyui-panel" title="订单详情" border="0">	
		<div class="easyui-panel" border="0" style="margin:5px;">
			  <table class="easyui-datagrid" style="width: 100%;height:150px;" id="Equip_Order_Details_tabs"
			data-options="url:'',fitColumns:true,rownumbers: true, singleSelect:true,pagination:true,onDblClickCell:addEquipStoSave">
			<thead>
				<tr>
					<th style="width:40%;" data-options="field:'edetailName3'">采购设备器材名</th>
					<th style="width:15%;" data-options="field:'edetailNum'">数量</th>
					<th style="width:15%;" data-options="field:'edetailUnit'">单位</th>
					<th style="width:15%;" data-options="field:'edetailType'">类型</th>
					<th style="width:15%;" data-options="field:'xx'">备注</th>				
				</tr>
			</thead>					
			</table>			
		</div>
		<!-- <div style="margin: 5px 3px;">
				<a href="#" class="easyui-linkbutton" 
				data-options="" iconCls="icon-save">全部入库</a>
				
		</div>			 -->
	</div>
	
	<div class="easyui-panel" title="入库设备器材" border="0" >
		<table>
		<tr>
			<td><input id="save_equipOrder_name" class="easyui-textbox" label="设备器材"></td>			
			<td><input id="save_equipOrder_num" class="easyui-numberbox" label="数量"></td>
			<td><input id="save_equipOrder_company" class="easyui-textbox" label="单位" data-options="width:180,readonly:true" ></td>
			<td><input id="save_equipOrder_type" class="easyui-textbox" label="类型" data-options="width:180,readonly:true"></td>
		</tr>
		<tr>
			<td><input id="save_equipOrder_Mdate" class="easyui-datebox" label="生产日期" >
			</td>
			<td><input id="save_equipOrder_Edate" class="easyui-datebox" label="有效日期" >
			</td>
		</tr>
		<tr>
			<td><input id="save_equipOrder_remarkers" class="easyui-textbox" label="备注" data-options="width:400,">
			</td>
		</tr>
		<tr>
			<td>
				<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="appendESOSave()">添加入库</a>
			</td>
		</tr>
		</table>
		<div class="easyui-panel" border="0" style="margin:5px;">
		<table class="easyui-datagrid" style="width: 100%;" id="save_equip_SOE"
			data-options="url:'',fitColumns:true,singleSelect:true,rownumbers: true">
			<thead>
				<tr>
					<th style="width:15%" data-options="field:'sdetailName'">采购设备器材名</th>
					<th style="width:10%" data-options="field:'sdetailNum'">数量</th>
					<th style="width:10%" data-options="field:'sdetailutil'">单位</th>
					<th style="width:10%" data-options="field:'sdetailtype'">类型</th>
					<th style="width:20%" data-options="field:'sdetailMdate'">生产日期</th>
					<th style="width:20%" data-options="field:'sdetailEdate'">有效日期</th>
					<th style="width:15%" data-options="field:'sdetailRemarks'">备注</th>
					
				</tr>
			</thead>					
			</table>			
		</div>			
	</div>	
	<div style="margin: 5px 3px;">
		<a href="javaScript:void(0)" class="easyui-linkbutton" iconCls="icon-save" data-options="onClick:SaveEquipOrder"> 确认入库</a>
		
	</div>	
</form>	

 <div id="checkEplanOrder_select" class="easyui-window" title="选择订单"
			data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-add',closed:true"
			style="width: 800px; height: 400px; padding: 5px;">
		<div style="margin-left: 5px;">
		<div style="margin: 10px">
			订单号<input id="equipBuyOrder_Id" style="width: 15%;" class="easyui-textbox" > 				
			供应商<input id="equipBuyOrder_businessName" style="width: 15%;" class="easyui-textbox" > 
			采购员<input id="equipBuyOrder_eorderName" style="width: 15%;" class="easyui-textbox" >
						
			<a href="#" class="easyui-linkbutton"   style="width: 8%;"  iconCls="icon-search"  data-options="onClick:equipBuyOrderWhere" >查询</a>					
		</div>	
			<table class="easyui-datagrid" style="width: 100%;height:300px;" id="BuyEplanOrder_list_tabs"		
				data-options="url:'get_BuyEplanOrder',fitColumns:true,pagination:true,rownumbers: true,singleSelect:true,onDblClickRow:getBuyEplanOrder">
				<thead>
					<tr>
					<th data-options="field:'equipPlan',hidden:true,formatter:function(value){
						return value.eplanId}">订单编号</th>
						<th style="width: 15%" data-options="field:'eorderId'">编号</th>
						<th style="width: 15%" data-options="field:'eorderName'">采购员</th>
						<th style="width: 15%" data-options="field:'eopPhone'">联系电话</th>
						<th style="width: 15%" data-options="field:'busOrdername'">供应商</th>
						<th style="width: 15%" data-options="field:'eorderBdate'">订购日期</th>
						<th style="width: 15%" data-options="field:'eorderEdate'">到货日期</th>
						<th style="width: 10%" data-options="field:'eorderState'">状态</th>					
				</tr>
				</thead>
			</table>
		</div> 			
	</div>   
</div>
</body>
</html>